package com.xltt.vehicleControl.activity;


import android.content.Intent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.xltt.vehicleControl.R;
import com.xltt.vehicleControl.base.BaseActivity;
import com.xltt.vehicleControl.fragment.VehicleFunctionFragment;
import com.xltt.vehicleControl.listener.OnLockOperateListener;
import com.xltt.vehicleControl.util.Logger;
import com.xltt.vehicleControl.view.LockView;
import com.xltt.vehicleControl.view.SubmitButton;

import butterknife.BindView;
import butterknife.OnClick;

public class LockSettingsActivity extends BaseActivity {

    @BindView(R.id.lock_view)
    LockView mLockView;

    @Override
    protected void initPresenter() {

    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_lock_settings;
    }

    @Override
    protected void initViews() {
        //  设置滑动阻尼大小
        mLockView.setDamping(2);
        //  初始化时设置蓝牙未连接，此时可以点击，但不能滑动
        //mLockView.setBluetoothConnect(false);
        //  添加滑动事件监听
        mLockView.setOnLockOperateListener(new OnLockOperateListener() {
            @Override
            public void onLockPrepared() {
                Logger.d("onLockPrepared");

            }

            @Override
            public void onUnLockPrepared() {
                Logger.d("onUnLockPrepared");
            }

            @Override
            public void onLockStart() {
                Logger.d("onLockStart");
                Intent intent = new Intent();
                intent.putExtra(VehicleFunctionFragment.COMMAND_PARAMETER, "start");
                setResult(VehicleFunctionFragment.LOCK_SETTINGS_RESULT_CODE,intent);
                finish();
            }

            @Override
            public void onUnlockStart() {
                Logger.d("onUnlockStart");
                Intent intent = new Intent();
                intent.putExtra(VehicleFunctionFragment.COMMAND_PARAMETER, "stop");
                setResult(VehicleFunctionFragment.LOCK_SETTINGS_RESULT_CODE,intent);
                finish();
            }

            @Override
            public void onNotPrepared() {
                Logger.d("onNotPrepared");
            }
        });
        //  设置点击事件监听
        mLockView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });
    }


}
